package gxdlxy.zx2201.chat5;

import java.time.LocalDate;
import java.time.Period;
import java.time.Year;

public class Test {

    public static void main(String[] args) {
        LocalDate startDate = LocalDate.of(2000, 2, 21);
        LocalDate endDate = LocalDate.of(2004,3, 21);
        Period period = Period.between(startDate, endDate);
        int count = 0;
        for (int year = startDate.getYear(); year < endDate.getYear(); year++) {
            if (Year.isLeap(year)) {
                count++;
            }
        }
        System.out.println(count);
        int numday;
        if (startDate.isLeapYear()) {
            numday = (count - 1) * 366 + (period.getYears() - count) * 365 +
                    endDate.getDayOfYear() + (startDate.lengthOfYear() - startDate.getDayOfYear());
            System.out.println(numday);
        } else {
            numday = count * 366 + (period.getYears() - count) * 365 + endDate.getDayOfYear() - startDate.getDayOfYear();
            System.out.println(numday);
        }
        System.out.println("从2004年2月21日到今天，已经过去了 " + period.getYears() + " 年 "
                + period.getMonths() + " 个月"
                + period.getDays() + " 天");
    }
}
